<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@taglib uri="http://www.springframework.org/tags" prefix="spring"%>
<%
	request.setAttribute("path", request.getContextPath());
%>
<script type="text/javascript">
$(function(){
	ajaxQuery("${root}/order/dispatch/list");
});
var orderId = null;
function  dispatchOrder(id,orgid){
	orderId = id;
	var uri = "${root}/shop/list/pop/orginit/shop/"+orgid;
	$.post(uri,function( html ){
		common.moalYesNoDialog(html,"店铺选择","selectShop()");
	});
}
function selectShop(){

	var $checkedItem = $("input[name='rdShopItem'][type='radio']:checked");
	var shopId = $checkedItem.val();
	if(orderId && shopId ){
		var uri = "${root}/order/dispatch/"+orderId + "/" +shopId;
		common.ajaxSubmit(uri,"","派单失败","",'updateOk()');
	}
	
}
function updateOk(){
	common.closeYesNoDialog();
	ajaxQuery("${root}/order/dispatch/list");
}
function ajaxQuery(uri){
	$("#pageIndex").val(1);
	ajaxPagingQuery(uri);
};
function ajaxPagingQuery(uri){
	
	var formData = $("#orderQueryForm").serialize() + "&" +  $("#orderPagingForm").serialize();
	common.progressDialog("...查询中...");
	$.post(uri, formData,function(html){
		$("#dataOrderList").html(html);
		common.closeProgressDialog();
	});
};
</script>
<jsp:include page="../base/master_js.jsp"></jsp:include>
<form class="form-horizontal" id="orderQueryForm" role="form">
	<input name="orderName" value="" type="hidden">
	<table class="table table-hover">
		<tr>
			<th>大区:</th>
			<td>
				<select id="firstOrg" name="firstOrg" class="input-xlarge" onchange="firstOrgChange(this,'secondOrg',false)">
					<option value=""></option>
					<c:forEach var="item" items="${firstOrgs}">
						<option value="${item.id }"><c:out value="${item.name }"/></option>
					</c:forEach>
				</select>
			</td>
			<th>办事处:</th>
			<td>
				<select id="secondOrg" name="secondOrg" class="input-xlarge" >
				</select>
			</td>
			<th>单据类型:</th>
			<td>
				<select id="firstOrg" name="type" class="input-xlarge">
					<option value=""></option>
					<c:forEach var="item" items="${orderTypeList}">
						<option value="${item.id }"><c:out value="${item.name }"/></option>
					</c:forEach>
				</select>
			</td>			
		</tr>
		<tr>
			<th>维修单号:</th>
			<td><input type="text" class="input-xlarge" name="code"/></td>
			<th>客户姓名:</th>
			<td>
				<input type="text" class="input-xlarge" name="customerName"/>
			</td>
			<th>&nbsp;</th>
			<td>
				&nbsp;
			</td>			
		</tr>
		<tr>
			<th>创建人:</th>
			<td><input type="text" class="input-xlarge" name="submitUser"  value=""/></td>
			<th>日期:</th>
			<td colspan="3">
				<input type="text" data-date="${today}"  data-date-format="yyyy-mm-dd" class="input-medium datepicker" id="startDate" name="startDate" >
                  	&nbsp;&nbsp;~&nbsp;&nbsp;
               <input type="text" data-date="${today}"  data-date-format="yyyy-mm-dd" class="input-medium datepicker" id="endDate" name="endDate" >
			</td>
		</tr>		
	</table>
	<div class="form-actions text-center">
		 <button type="button" class="btn btn-primary" onclick="common.ajaxQuery('${root}/order/dispatch/list')">查询</button>
	 </div>
</form>
<div class="table-responsive">
<table class="table table-striped table-bordered">
	<thead>
		<tr >
			<th class="span2 text-center">大区</th>
			<th class="span2 text-center">办事处</th>
			<th class="span2 text-center">订单</th>
			<th class="text-center">客户</th>
			<th class="span2 text-center">类型</th>
			<th class="span2 text-center">日期</th>
			<th class="span2 text-center">状态</th>
			<th class="span2 text-center">操作</th>
		</tr>
	</thead>
	<tbody id="dataOrderList">
	</tbody>
</table>
</div>

